package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.health.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface SetMealMapper extends BaseMapper<Setmeal> {
    //修改中删除第三张表的数据
    @Delete("delete from t_setmeal_checkgroup where SETMEAL_ID = #{id}")
   void updateSetmealById(@Param("id") Integer id);

    //添加操作
    @Insert("insert into t_setmeal_checkgroup values (#{sid},#{checkgroupId})")
    void addSetmeal(@Param("sid") Integer sid, @Param("checkgroupId") Integer checkgroupId);

    //通过套餐主键查询中间表中所有对应的检查组id
    @Select("select CHECKGROUP_ID from t_setmeal_checkgroup where SETMEAL_ID = #{sid}")
    Integer[] findCheckGroupById(@Param("sid") Integer id);
}
